// PasswordDialog.cpp

#include "StdAfx.h"

#include "PasswordDialog.h"

#ifdef LANG
#include "Common/Lang/LangUtils.h"
#endif

using namespace Common;

#ifdef LANG
static Lang::CIDLangPair kIDLangPairs[] =
{
  { IDC_STATIC_PASSWORD_HEADER, 0x02000B01 },
  { IDC_CHECK_PASSWORD_SHOW, 0x02000B02 },
  { IDOK, 0x02000702 },
  { IDCANCEL, 0x02000710 }
};
#endif


LRESULT CPasswordDialog:: OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
  #ifdef LANG
  Lang::LangSetWindowText(HWND(*this), 0x02000B00);
  Lang::LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
  #endif
  _passwordControl.Attach(GetDlgItem(IDC_EDIT_PASSWORD));
  _passwordControl.SetWindowText(Password);
  _passwordControl.SetPasswordChar(TEXT('*'));
  CenterWindow(GetParent());
  return TRUE;
}

LRESULT CPasswordDialog::OnShowPassword(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	_passwordControl.SetPasswordChar(IsDlgButtonChecked(IDC_CHECK_PASSWORD_SHOW) == BST_CHECKED ? 0: TEXT('*'));
    CString password;
    _passwordControl.GetWindowText(password);
    _passwordControl.SetWindowText(password);
    return TRUE;  
}

